import logo from "./logo.svg";
import "./App.css";
import { useEffect, useState } from "react";

function App() {
  const [count, setCount] = useState(0);
  setCount(count + 1);
  useEffect(() => {
    let _count = 0;
    let inter = setInterval(() => {
      _count++;
      if (_count < 5) {
        setCount(count + 1);
        console.log("count", count);
      } else {
        clearInterval(inter);
      }
    }, 1000);
    return () => {
      // clearTimeout(inter);
    };
  }, []);

  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

export default App;
